<?php
#####################################################
# RWCARDS - Joomla E-Cards Componment!
# Copyright (C) 2004/2005 by Ralf Weber
# Company    : LoadBrain
# Homepage   : www.weberr.de
# Version    : 2.1.0
# Date       : 23/11/2005
# License    : Released under GPL
######################################################

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

if ( !defined('_RWCARDS_LANG_INCLUDED') ) 
{
  	if ( file_exists($mosConfig_absolute_path . "/components/com_rwcards/language/" . $mosConfig_lang . ".php") )
	{
    	include_once($mosConfig_absolute_path . "/components/com_rwcards/language/" . $mosConfig_lang . ".php");
  	}
	else 
	{
    	include_once($mosConfig_absolute_path . "/components/com_rwcards/language/english.php");
	}
}

class rwcards_sentcards_html
{
/**
* List all sent cards
*/		
	function RWCardsListSentCards( &$rows, &$pageNav, $search, $option ) 
	{
    global $mosConfig_live_site, $my;
?>
<br />

<div align="center" class="centermain">
<table border="0" cellspacing="0" cellpadding="5">
<tr>
	<td><img src="./components/com_rwcards/images/admin_manage_over.jpg" alt="<?php echo _ADMIN_RWCARDS_MANAGE_SENTCARDS; ?>" width="50" height="36" border="0"></td>
	<th><?php echo _ADMIN_RWCARDS_MANAGE_SENTCARDS; ?></td>
	</tr>
</table>
<br />
	<form action="index2.php" method="post" name="adminForm">
	<table cellpadding="4" cellspacing="0" border="0" width="100%">
		<tr> 
      <td width="100%" class="sectionname">&nbsp;</td>
			<td nowrap="nowrap"><?php echo _ADMIN_RWCARDS_DISPLAY; ?> #</td>
			<td> <?php echo $pageNav->writeLimitBox(); ?> </td>
			<td><?php echo _ADMIN_RWCARDS_SEARCH; ?>:</td>
			<td><input type="text" name="search" value="<?php echo $search;?>" class="inputbox" onChange="document.adminForm.submit();" /></td>
		</tr>
	</table>
	<table cellpadding="4" cellspacing="0" border="1" width="100%" class="adminlist">
		<tr>
			<th width="20" nowrap="nowrap">#</th>
			<th width="20" class="title" nowrap="nowrap"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows); ?>);" /></th>
			<th class="title" nowrap="nowrap"><?php echo _ADMIN_RWCARDS_MANAGE_SENTCARDS_DATE; ?></th>
			<th class="title" nowrap="nowrap"><?php echo _ADMIN_RWCARDS_MANAGE_SENTCARDS_SENT; ?></th>
			<th class="title" nowrap="nowrap"><?php echo _ADMIN_RWCARDS_MANAGE_SENTCARDS_SEND_DATE; ?></th>
			<th class="title" nowrap="nowrap"><?php echo _ADMIN_RWCARDS_MANAGE_SENTCARDS_AUTHOR; ?></th>
			<th class="title" nowrap="nowrap"><?php echo _ADMIN_RWCARDS_MANAGE_SENTCARDS_EMAIL; ?></th>
			<th class="title" nowrap="nowrap"><?php echo _ADMIN_RWCARDS_MANAGE_SENTCARDS_RECEIVER; ?></th>
			<th class="title" nowrap="nowrap"><?php echo _ADMIN_RWCARDS_MANAGE_SENTCARDS_RECEIVER_EMAIL; ?></th>
			<th class="title" nowrap="nowrap"><?php echo _ADMIN_RWCARDS_MANAGE_SENTCARDS_PICTURE; ?></th>
			<th class="title" nowrap="nowrap"><?php echo _ADMIN_RWCARDS_MANAGE_SENTCARDS_MESSAGE; ?></th>
			<th class="title" nowrap="nowrap"><?php echo _ADMIN_RWCARDS_MANAGE_SENTCARDS_WAS_READ; ?></th>
		</tr>
<?php
		$k = 0;
		for ($i=0, $n=count($rows); $i < $n; $i++) 
		{
			$row = $rows[$i];
			$sent = $row->cardSent ? 'tick.png' : 'publish_x.png';
			$senttitle = $row->cardSent ? _ADMIN_RWCARDS_MANAGE_SENTCARDS_SENT : _ADMIN_RWCARDS_MANAGE_SENTCARDS_NOT_SENT;
			$img = $row->cardRead ? 'tick.png' : 'publish_x.png';
			$task = $row->cardRead ? 'unpublish' : 'publish';
			$title = $row->cardRead ? _ADMIN_RWCARDS_CATEGORY_PUBLISHED : _ADMIN_RWCARDS_CATEGORY_UNPUBLISHED;
      	if ( @$row->checked_out ) 
		{
			  $checked = mosCommonHTML::checkedOut( $row );
  		} else 
		{
  			$checked = mosHTML::idBox( $i, $row->id, (@$row->checked_out && $row->checked_out != $my->id ), 'pid' );
  		}
      $link = 'index2.php?option=com_rwcards&hidemainmenu=1&task=sentcards&pid[]='.$row->id;
?>
		<tr class="<?php echo "row$k"; ?>"> 
			<td><?php echo $i+1+$pageNav->limitstart; ?></td>
			<td><?php echo $checked; ?></td>
			<td><?php echo $row->writtenOn; ?></td>
			<td align="center"><img src="images/<?php echo $sent;?>" width="12" height="12" border="0" alt="" title="<?php echo $senttitle; ?>" /></td>
	  		<td><?php echo $row->sendDate; ?></td>
	  		<td><?php echo $row->nameFrom; ?></td>
			<td><?php echo $row->emailFrom; ?></td>
	  		<td><?php echo $row->nameTo; ?></td>
			<td><?php echo $row->emailTo; ?></td>
			<td width="80"><a href="#" onMouseOver="return overlib('<img src=../images/stories/cards/<?php echo $row->picture; ?> border=1 style=padding:5px;background-color:#f0f0f0;/>', FULLHTML, BGCOLOR, '#006600', ABOVE, LEFT);" onmouseout="return nd();" ><img src="../images/stories/cards/<?php echo strtolower( substr($row->picture, 0, -4) ) . "_t.jpg"; ?>" border="0" /></a></td>
			<td><?php echo $row->message; ?></td>
		  <td align="center"><img src="images/<?php echo $img;?>" width="12" height="12" border="0" alt="" title="<?php echo $title; ?>" /></td>
		</tr>
    <?php $k = 1 - $k;
			} ?>
    <tr> 
      <th align="center" colspan="12"> <?php echo $pageNav->writePagesLinks(); ?></th>
    </tr>
    <tr> 
      <td align="center" colspan="12"> <?php echo $pageNav->writePagesCounter(); ?></td>
    </tr>
  </table>
  <input type="hidden" name="option" value="<?php echo $option; ?>" />
  <input type="hidden" name="task" value="sentcards" />
  <input type="hidden" name="boxchecked" value="0" />
  <input type="hidden" name="hidemainmenu" value="0" />
</form>
<?php
  }

 }